﻿<Controls:PhoneApplicationPage x:Class="TexasHoldemCalculator.View.StatsView" 
                               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
                               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                               xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
                               xmlns:Controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" 
                               xmlns:Custom="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" 
                               xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                               xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                               xmlns:MvvmLite="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP71" 
                               xmlns:my="clr-namespace:Microsoft.Advertising.Mobile.UI;assembly=Microsoft.Advertising.Mobile.UI" 
                               x:Name="StatisticsViewPage"
                               ApplicationBar="{StaticResource GlobalApplicationBar}"
                               d:DesignHeight="800" d:DesignWidth="480"
                               Style="{StaticResource DefaultPageTransition}"
                               SupportedOrientations="Portrait" mc:Ignorable="d">
    <Grid x:Name="LayoutRoot">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="480" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="643" />
            <RowDefinition Height="85" />
        </Grid.RowDefinitions>

        <controls:Panorama Title="Statistics" Grid.Row="0" Height="645" VerticalAlignment="Top"
                           Name="StatisticsPanorama"
                           Style="{StaticResource StatsPanoramaStyle}"
                           DataContext="{Binding Source={StaticResource Locator}, Path=OddsStatistics}">
            <Custom:Interaction.Triggers>
                <Custom:EventTrigger EventName="SelectionChanged">
                    <MvvmLite:EventToCommand x:Name="SelectedStatsChangedCommand" 
                                             Command="{Binding SelectedStatsChanged}"
                                             CommandParameter=
                                                "{Binding 
                                                    ElementName=StatisticsPanorama, Path=SelectedIndex}"/>
                </Custom:EventTrigger>
            </Custom:Interaction.Triggers>

            <controls:PanoramaItem Width="436" Height="515" DataContext="{Binding Source={StaticResource Locator}, Path=OddsStatistics}" 
                                   Header="Pot Odds">
                <StackPanel Width="436">
                    <Grid x:Name="HandStatsGrid" Width="436" Height="200">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="80" />
                            <ColumnDefinition Width="120" />
                            <ColumnDefinition Width="120" />
                            <ColumnDefinition Width="120" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="40" />
                            <RowDefinition Height="40" />
                            <RowDefinition Height="40" />
                            <RowDefinition Height="40" />
                            <RowDefinition Height="40" />
                        </Grid.RowDefinitions>

                        <!--  Hand Odds  -->
                        <TextBlock x:Name="ProbRatioLabel" Grid.Row="2" Grid.Column="0" FontSize="16"
                                   Style="{StaticResource THCSmallHeaderStyle}"
                                   Text="Hand Odds" />
                        <TextBlock x:Name="ProbHandPercentTextBlock" Grid.Row="1" FontSize="18.667"
                                   Style="{StaticResource THCSmallHeaderStyle}"
                                   Text="Percent %" />

                        <!--  Flop x:1 odds  -->
                        <TextBlock x:Name="HandRatioFlopTextBlock" Grid.Row="2" Grid.Column="1" FontSize="26.667"
                                   Style="{StaticResource THCLargeValueStyle}"
                                   Text="{Binding HandOddsFlopText}" />
                        <!--  Flop x:1 odds  -->
                        <TextBlock x:Name="HandRatioTurnTextBlock" Grid.Row="2" Grid.Column="2" FontSize="26.667"
                                   Style="{StaticResource THCLargeValueStyle}"
                                   Text="{Binding HandOddsTurnText}" />
                        <!--  Flop x:1 odds  -->
                        <TextBlock x:Name="HandRatioRiverTextBlock" Grid.Row="2" Grid.Column="3" FontSize="26.667"
                                   Style="{StaticResource THCLargeValueStyle}"
                                   Text="{Binding HandOddsRiverText}" />

                        <!--  Flop %  -->
                        <TextBlock x:Name="ProbHandFlopLabel" Grid.Row="0" Grid.Column="1" FontSize="20"
                                   Style="{StaticResource THCSmallHeaderStyle}"
                                   Text="Flop %" />
                        <TextBlock x:Name="ProbHandFlopTextBlock" Grid.Row="1" Grid.Column="1" FontSize="26.667"
                                   Style="{StaticResource THCLargeValueStyle}"
                                   Text="{Binding FlopPercentText}" />

                        <!--  Turn %  -->
                        <TextBlock x:Name="ProbHandTurnLabel" Grid.Row="0" Grid.Column="2" FontSize="20"
                                   Style="{StaticResource THCSmallHeaderStyle}"
                                   Text="Turn %" />
                        <TextBlock x:Name="ProbHandTurnTextBlock" Grid.Row="1" Grid.Column="2" FontSize="26.667"
                                   Style="{StaticResource THCLargeValueStyle}"
                                   Text="{Binding TurnPercentText}" />

                        <!--  River %  -->
                        <TextBlock x:Name="ProbHandRiverLabel" Grid.Row="0" Grid.Column="3" HorizontalAlignment="Center"
                                   FontSize="20"
                                   Style="{StaticResource THCSmallHeaderStyle}"
                                   Text="River %" />
                        <TextBlock x:Name="ProbHandRiverTextBlock" Grid.Row="1" Grid.Column="3" FontSize="26.667"
                                   Style="{StaticResource THCLargeValueStyle}"
                                   Text="{Binding RiverPercentText}" />

                        <TextBlock x:Name="PotOddsTextLabel" Grid.Row="3" Grid.Column="0" FontSize="16"
                                   Style="{StaticResource THCSmallHeaderStyle}"
                                   Text="Pot Odds" />
                        <TextBlock x:Name="PotOddsTextBlock" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="3"
                                   FontSize="26.667"
                                   Style="{StaticResource THCLargeValueStyle}"
                                   Text="{Binding PotOddsText}" />

                        <TextBlock x:Name="MaxBetTextLabel" Grid.Row="4" Grid.Column="0" FontSize="16"
                                   Style="{StaticResource THCSmallHeaderStyle}"
                                   Text="Max Bet" />
                        <TextBlock x:Name="HandOddsTextBlock" Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3"
                                   FontSize="26.667"
                                   Foreground="{Binding CurrentBorderBrush,
                                                        Mode=TwoWay}"
                                   Style="{StaticResource THCLargeValueStyle}"
                                   Text="{Binding MaxBetText,
                                                  Converter={StaticResource IntConverter}}" />
                    </Grid>

                    <Grid x:Name="PotStatsGrid" Width="436" Height="200" Margin="0,10,0,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="120" />
                            <ColumnDefinition Width="294" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="60" />
                            <RowDefinition Height="60" />
                            <RowDefinition Height="60" />
                            <RowDefinition Height="60*" />
                        </Grid.RowDefinitions>

                        <!--  Pot Size  -->
                        <TextBlock x:Name="PotSizeTextBlock" Grid.Row="0" Grid.Column="0"
                                   Style="{StaticResource THCSmallHeaderStyle}"
                                   Text="Pot Size" />
                        <TextBox x:Name="PotSizeButton" Grid.Row="0" Grid.Column="1" Width="155"
                                 Height="55" Canvas.ZIndex="4" GotFocus="StatsTextBoxGotFocus" InputScope="Digits"
                                 Style="{StaticResource THCDataTextBoxStyle}"
                                 Template="{StaticResource THCInputTextBoxStyle}"
                                 Text="{Binding PotSize,
                                                Converter={StaticResource IntConverter},
                                                Mode=TwoWay}" />
                        <!--  Bet Size  -->
                        <TextBlock x:Name="BetSizeTextBlock" Grid.Row="1" Margin="0"
                                   Style="{StaticResource THCSmallHeaderStyle}"
                                   Text="Bet Amount" />
                        <TextBox x:Name="BetSizeButton" Grid.Row="1" Grid.Column="1" Width="155"
                                 Height="55" Canvas.ZIndex="3" GotFocus="StatsTextBoxGotFocus" InputScope="Digits"
                                 Style="{StaticResource THCDataTextBoxStyle}"
                                 Template="{StaticResource THCInputTextBoxStyle}"
                                 Text="{Binding MaxBet,
                                                Converter={StaticResource IntConverter},
                                                Mode=TwoWay}" />
                        <!--  Number of Outs  -->
                        <TextBlock x:Name="OutsTextBlock" Grid.Row="2" Grid.Column="0"
                                   Style="{StaticResource THCSmallHeaderStyle}"
                                   Text="Num. Outs" />

                        <Button Name="OutsButton" Grid.Row="2" Grid.Column="1" Width="155"
                                Height="55"
                                Content="{Binding NumberOfOuts}"
                                Padding="0"
                                Style="{StaticResource RoundButtonStyle}">
                            <Custom:Interaction.Triggers>
                                <Custom:EventTrigger EventName="Click">
                                    <MvvmLite:EventToCommand x:Name="OutsVisibilityCommand" Command="{Binding OutsVisibilityCommand}" />
                                </Custom:EventTrigger>
                            </Custom:Interaction.Triggers>
                        </Button>
                    </Grid>
                </StackPanel>
            </controls:PanoramaItem>

            <controls:PanoramaItem Width="436" Height="515" DataContext="{Binding Source={StaticResource Locator}, Path=RunnerStatistics}" Header="Runner">
                <Grid>
                    <Grid Name="THCStatRunnerRunnerGrid">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="120" />
                            <ColumnDefinition Width="294" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="50" />
                            <RowDefinition Height="50" />
                            <RowDefinition Height="50" />
                            <RowDefinition Height="50" />
                            <RowDefinition Height="100" />
                        </Grid.RowDefinitions>

                        <TextBlock Name="StatRunnerOutsTextBlock" Grid.Row="0" Grid.Column="0"
                                   Style="{StaticResource THCSmallHeaderStyle}"
                                   Text="No.Outs" />
                        <Button Name="RunnerOutsTextBox" Grid.Row="0" Grid.Column="1" Width="125"
                                Height="45"
                                Content="{Binding NumberOfOuts}"
                                Style="{StaticResource RoundButtonShortStyle}">
                            <Custom:Interaction.Triggers>
                                <Custom:EventTrigger EventName="Click">
                                    <MvvmLite:EventToCommand x:Name="RunnerOutsCommand" Command="{Binding OutsVisibilityCommand}" />
                                </Custom:EventTrigger>
                            </Custom:Interaction.Triggers>
                        </Button>

                        <TextBlock Name="StatRunnerProbTextBlock" Grid.Row="1" Grid.Column="0"
                                   Style="{StaticResource THCSmallHeaderStyle}"
                                   Text="Probability" />
                        <TextBlock Name="StatRunnerProbData" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Stretch"
                                   Style="{StaticResource THCLargeValueStyle}"
                                   Text="{Binding RunnerProbability}" />

                        <TextBlock Name="StatRunerRatioTextBlock" Grid.Row="2" Grid.Column="0"
                                   Style="{StaticResource THCSmallHeaderStyle}"
                                   Text="Ratio" />
                        <TextBlock Name="StatRunerRatioData" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Stretch"
                                   Style="{StaticResource THCLargeValueStyle}"
                                   Text="{Binding RunnerRatio}" />

                        <TextBlock Name="StatsRunnerRunnerExplanation" Grid.Row="3" Grid.RowSpan="2" Grid.ColumnSpan="2" TextWrapping="Wrap"
                                   HorizontalAlignment="Stretch"
                                   Style="{StaticResource THCLargeValueStyle}"
                                   Text="{Binding RunnerRunnerPercentExplanation}" VerticalAlignment="Stretch" Margin="0" />

                    </Grid>
                </Grid>
            </controls:PanoramaItem>

            <controls:PanoramaItem Width="436" Height="515" DataContext="{Binding Source={StaticResource Locator}, Path=KickerStatistics}" Header="Vs. Big Kicker">
                <StackPanel>
                    <Grid Name="THCStatPlayerGrid" Width="414" Height="200">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="120" />
                            <ColumnDefinition Width="294" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="50" />
                            <RowDefinition Height="50" />
                            <RowDefinition Height="50" />
                            <RowDefinition Height="50" />
                        </Grid.RowDefinitions>

                        <TextBlock Name="StatPlayerTextBlock" Grid.Row="0" Grid.Column="0"
                                   Style="{StaticResource THCSmallHeaderStyle}"
                                   Text="Players" />
                        <Button Name="PlayersOutsTextBox" Grid.Row="0" Grid.Column="1" Width="125"
                                Height="45" Margin="0"
                                Content="{Binding NumberOfPlayers}"
                                Style="{StaticResource RoundButtonShortStyle}">
                            <Custom:Interaction.Triggers>
                                <Custom:EventTrigger EventName="Click">
                                    <MvvmLite:EventToCommand x:Name="PlayersVisibilityCommand" Command="{Binding VisibilityCommand}" />
                                </Custom:EventTrigger>
                            </Custom:Interaction.Triggers>
                        </Button>

                        <TextBlock Name="StatRatioTextBlock" Grid.Row="2" Grid.Column="0"
                                   Style="{StaticResource THCSmallHeaderStyle}"
                                   Text="Ratio" />
                        <TextBlock Name="StatPercentTextBlock" Grid.Row="3" Grid.Column="0"
                                   Style="{StaticResource THCSmallHeaderStyle}"
                                   Text="Percent" />

                        <TextBlock Name="StatsKickerTextBlock" Grid.Row="1" Grid.Column="0"
                                   Style="{StaticResource THCSmallHeaderStyle}"
                                   Text="Kicker" />
                        <Button x:Name="StatKickerTextBlock" Grid.Row="1" Grid.Column="1" Width="125"
                                Height="45" Margin="0"
                                Content="{Binding SelectedKicker}"
                                Style="{StaticResource RoundButtonShortStyle}">
                            <Custom:Interaction.Triggers>
                                <Custom:EventTrigger EventName="Click">
                                    <MvvmLite:EventToCommand x:Name="StatsKickerCommand" Command="{Binding Visibility1Command}" />
                                </Custom:EventTrigger>
                            </Custom:Interaction.Triggers>
                        </Button>

                        <TextBlock Name="StatRatioData" Grid.Row="2" Grid.Column="1"
                                   Style="{StaticResource THCLargeValueStyle}"
                                   Text="{Binding KickerRatio}" />
                        <TextBlock Name="StatPercentData" Grid.Row="3" Grid.Column="1"
                                   Style="{StaticResource THCLargeValueStyle}"
                                   Text="{Binding KickerPercent}" />
                    </Grid>
                    <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
                        <Image Name="StatHandAceImage" Margin="0,0,10,0" Source="{Binding CardImageOne}" Style="{StaticResource THCCardStyle}" />
                        <Image Name="StatHandKickerImage" Width="84" HorizontalAlignment="Center"
                               Source="{Binding CardImageTwo}"
                               Style="{StaticResource THCCardStyle}" />
                    </StackPanel>
                </StackPanel>
            </controls:PanoramaItem>

            <controls:PanoramaItem Width="436" Height="515" DataContext="{Binding Source={StaticResource Locator}, Path=PairStatistics}" Header="Vs. Big Pair">
                <StackPanel Orientation="Vertical">
                    <Grid Name="THCStatBiggerAceValueGrid" Width="414" Height="200">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="120" />
                            <ColumnDefinition Width="294" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="50" />
                            <RowDefinition Height="50" />
                            <RowDefinition Height="50" />
                            <RowDefinition Height="50" />
                        </Grid.RowDefinitions>

                        <TextBlock Name="StatPocketPair" Grid.Row="0" Grid.Column="0"
                                   Style="{StaticResource THCSmallHeaderStyle}"
                                   Text="Pocket Pair" />
                        <TextBlock Name="StatPocketProbTextBlock" Grid.Row="1" Grid.Column="0"
                                   Style="{StaticResource THCSmallHeaderStyle}"
                                   Text="Probability" />

                        <TextBlock Name="StatPocketRatioTextBlock" Grid.Row="2" Grid.Column="0"
                                   Style="{StaticResource THCSmallHeaderStyle}"
                                   Text="Ratio" />
                        <TextBlock Name="StatPocketPercentTextBlock" Grid.Row="3" Grid.Column="0"
                                   Style="{StaticResource THCSmallHeaderStyle}"
                                   Text="Percent" />

                        <Button x:Name="PairKickerTextBlock" Grid.Row="0" Grid.Column="1" Width="125"
                                Height="45" Margin="0"
                                Content="{Binding SelectedKicker}"
                                Style="{StaticResource RoundButtonShortStyle}">
                            <Custom:Interaction.Triggers>
                                <Custom:EventTrigger EventName="Click">
                                    <MvvmLite:EventToCommand x:Name="PairKickerCommand" Command="{Binding Visibility1Command}" />
                                </Custom:EventTrigger>
                            </Custom:Interaction.Triggers>
                        </Button>
                        <TextBlock Name="StatPocketProbData" Grid.Row="1" Grid.Column="1"
                                   Style="{StaticResource THCLargeValueStyle}"
                                   Text="{Binding PocketPairProbability}" />
                        <TextBlock Name="StatPocketRatioData" Grid.Row="2" Grid.Column="1"
                                   Style="{StaticResource THCLargeValueStyle}"
                                   Text="{Binding PocketPairRatio}" />
                        <TextBlock Name="StatPocketPrecentData" Grid.Row="3" Grid.Column="1"
                                   Style="{StaticResource THCLargeValueStyle}"
                                   Text="{Binding PocketPairPercent}" />
                    </Grid>
                    <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
                        <Image Name="StatPocketPairImageA" Margin="0,0,10,0" Source="{Binding CardImageOne}" Style="{StaticResource THCCardStyle}" />
                        <Image Name="StatPocketPairImageB" Width="84" Source="{Binding CardImageTwo}" Style="{StaticResource THCCardStyle}" />
                    </StackPanel>
                </StackPanel>
            </controls:PanoramaItem>

        </controls:Panorama>

        <my:AdControl x:Name="THCStatisticsAd" Grid.Row="1"
                      Width="{Binding Width}"
                      Height="{Binding Height}"
                      VerticalAlignment="Center"
                      DataContext="{Binding Source={StaticResource Locator}, Path=AdProvider}" />

        <!--  =======================  -->
        <!--  Kicker Popup Controls  -->
        <!--  =======================  -->
        <ItemsControl x:Name="PlayersSelectionPopup" Grid.Row="0" Grid.RowSpan="2" d:IsHidden="True"
                      DataContext="{Binding Source={StaticResource Locator},
                                            Path=KickerStatistics}"
                      Template="{StaticResource PlayerCountPopBorder}"
                      Visibility="{Binding Visibility}" />

        <ItemsControl x:Name="KickerSelectionPopup" Grid.Row="0" Grid.RowSpan="2" d:IsHidden="True"
                      DataContext="{Binding Source={StaticResource Locator},
                                            Path=KickerStatistics}"
                      Template="{StaticResource SelectedKickerPopupBorder}"
                      Visibility="{Binding Visibility1}" />

        <ItemsControl x:Name="OutsSelectionPopup" Grid.Row="0" Grid.RowSpan="2" d:IsHidden="True"
                      DataContext="{Binding Source={StaticResource Locator},
                                            Path=RunnerStatistics}"
                      Template="{StaticResource SelectedOutsPopupBorder}"
                      Visibility="{Binding OutsVisibility}" />

        <!--  =======================  -->
        <!--  Pair Popup Controls  -->
        <!--  =======================  -->
        <ItemsControl x:Name="PairSelectinPopup" Grid.Row="0" Grid.RowSpan="2" d:IsHidden="True"
                      DataContext="{Binding Source={StaticResource Locator},
                                            Path=PairStatistics}"
                      Template="{StaticResource SelectedKickerPopupBorder}"
                      Visibility="{Binding Visibility1}" />

        <!--  =======================  -->
        <!--  Outs Popup Controls  -->
        <!--  =======================  -->
        <ItemsControl x:Name="OddsOutsSelectionPopup" Grid.Row="0" Grid.RowSpan="2" d:IsHidden="True"
                      DataContext="{Binding Source={StaticResource Locator},
                                            Path=OddsStatistics}"
                      Template="{StaticResource SelectedOutsPopupBorder}"
                      Visibility="{Binding OutsVisibility}" />

    </Grid>

</Controls:PhoneApplicationPage>